/*
 * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include <QObject>
#include <QMap>

class DBusInvokerInterface;
class SettingsInvokerInterface;
class SecurityLevelModel : public QObject
{
    Q_OBJECT
public:
    explicit SecurityLevelModel(QObject *parent = nullptr);

    // 获取当前系统安全等级gsetting
    int getSystemSafeLevel();

    // 设置等保开启/关闭
    void setSystemLevel(int nType, bool isStatus, bool isDeleteUser, const QString &sSysadmPassword, const QString &sSecadmPassword, const QString &sAudadmPassword);

    // 设置系统安全等级切换
    void setSystemLevelChange(int nType);

    // 得到当前用户
    QString getCurrentUserName();

    // 是否显示高等级
    bool isShowHighLevel();

    // 判断当前是否是wayland
    bool getIsWaylandDisplay();

public Q_SLOTS:
    // 得到等保开启/关闭状态
    void getSystemLevelSettingResult(bool isSuccess, int nType);

Q_SIGNALS:
    void notifySystemLevelChangeFinish(bool isSuccess, int nType);

private:
    // 等保系统服务
    DBusInvokerInterface *m_systemLevelDBusInter;
    SettingsInvokerInterface *m_gsetting; // 安全中心gsetting配置
    DBusInvokerInterface *m_accountsDBusInter;

    QString m_currentUserName;
    bool m_isEnhanceInstall;
    QMap<QString, DBusInvokerInterface *> m_accountInterMap;
};
